VERSION 5.00
Begin VB.Form frmcontratosValoresTomados 
   BackColor       =   &H80000013&
   BorderStyle     =   4  'Fixed ToolWindow
   ClientHeight    =   2415
   ClientLeft      =   15
   ClientTop       =   -15
   ClientWidth     =   7155
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   Moveable        =   0   'False
   ScaleHeight     =   2415
   ScaleWidth      =   7155
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtCodigoContrato 
      Height          =   375
      Left            =   1920
      TabIndex        =   0
      Top             =   960
      Width           =   1455
   End
   Begin VB.CommandButton cmdImprimir 
      BackColor       =   &H0000FFFF&
      Caption         =   "Imprimir"
      Height          =   615
      Left            =   4920
      Picture         =   "frmcontratosValoresTomados.frx":0000
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   1320
      Width           =   732
   End
   Begin VB.CommandButton CmdSalir 
      BackColor       =   &H0080FFFF&
      Caption         =   "&Salir"
      BeginProperty Font 
         Name            =   "Arial"
         Size            =   6.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   5760
      Picture         =   "frmcontratosValoresTomados.frx":030A
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1320
      Width           =   735
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "Contratos con valores tomados"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   495
      Left            =   360
      TabIndex        =   5
      Top             =   240
      Width           =   4935
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "NUMERO DE CONTRATO"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   495
      Left            =   360
      TabIndex        =   4
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label lblAsesorVentas 
      BackStyle       =   0  'Transparent
      Caption         =   "dfafafafaf"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   1680
      Width           =   4335
   End
End
Attribute VB_Name = "frmcontratosValoresTomados"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private unidad As String
Private Vendedor As String
Private codigounidad As String
Private u As String

Private Sub CmdBuscar_Click()
  frmBuscarCriterioEmpleados.Show 1
    MostrarRegistroEmpleados
End Sub

Private Sub cmdImprimir_Click()

   If u = "gev" Or u = "anam" Or Usuario = "Carlos Alfredo Castro" Then
        UnidadVentaPublica = "099"
        codigounidad = "099"
   End If

    If UnidadVentaPublica <> codigounidad Then
        MsgBox "ESTE VENDEDOR PERTENECE A OTRA UNIDAD DE VENTAS, POR LO TANTO NO SE PUEDE VER SUS CONTRATOS"
       Exit Sub
    End If
    

    RutaReportes = DE.rsGENCParametros.Fields("RUTA_REPORTES")
    MDI.Reporte.StoredProcParam(0) = RTrim(Vendedor)
    MDI.Reporte.StoredProcParam(1) = RTrim(UCase(txtCodigoContrato))
    Imprimir RutaReportes & "ContratoConValoresTomados.rpt", "", "", "", ""
End Sub

Private Sub cmdSalir_Click()
    Unload Me
End Sub

Private Sub Form_Load()

    Left = Screen.Width / 2 - Width / 2
    Top = (Screen.Height / 2 - Height / 2) - 800




    u = clavedigitada
    UnidadVentaPublica = "00" + Mid(u, 7, 1)
    
    
      If u = "abcdef1" Then UnidadVentaPublica = "001"
    If u = "asesor7" Then UnidadVentaPublica = "007"
    If u = "cs19" Then UnidadVentaPublica = "019"
    If u = "uni19" Then UnidadVentaPublica = "019"
    If u = "sc001" Then UnidadVentaPublica = "019"
    If u = "xplm031" Then UnidadVentaPublica = "031"
    If u = "uni032" Then UnidadVentaPublica = "032"
    If u = "unida33" Then UnidadVentaPublica = "033"
    If u = "qqees35" Then UnidadVentaPublica = "035"
    If u = "unida36" Then UnidadVentaPublica = "036"
    If u = "u43" Then UnidadVentaPublica = "043"
    If u = "u45" Then UnidadVentaPublica = "045"
    If u = "u46" Then UnidadVentaPublica = "046"
    
    
End Sub

Private Sub txtCodigoContrato_KeyDown(KeyCode As Integer, Shift As Integer)
HacerTab KeyCode
End Sub

Private Sub txtCodigoContrato_LostFocus()
    'busco que el contrato tenga valores tomados
    
    
    If txtCodigoContrato.Text = "" Then
       MsgBox "Este campo no debe quedar vacio..."
        Exit Sub
    
    End If
    
    If DE.rscontratoVT.State = adStateOpen Then DE.rscontratoVT.Close
    DE.contratoVT UCase(txtCodigoContrato)
    
    If DE.rscontratoVT.EOF Then
        MsgBox "Este contrato no tiene Valores Tomados..."
        Exit Sub
        
    End If
    
    With DE.rscontratoVT
        Vendedor = .Fields("Codigo_Vendedor")
        lblAsesorVentas.Caption = .Fields("nombres")
        codigounidad = .Fields("codigo_unidad_de_venta")
        
    End With
    
    
    
End Sub


Private Sub MostrarRegistroEmpleados()
    
    If DE.rsBusqueEmpleado2.State = adStateOpen Then DE.rsBusqueEmpleado2.Close
    DE.BusqueEmpleado2 CodigoPublico
    
    If CodigoPublico = "" Then Exit Sub
    
    If DE.rsBusqueEmpleado2.EOF Then
        MsgBox "Este asesor no existe o esta inactivo"
        Exit Sub
    End If
    
     With DE.rsBusqueEmpleado2
        txtCodigoVendedor.Text = .Fields("Codigo_Empleado")
        lblAsesorVentas.Caption = .Fields("nombres")
        unidad = .Fields("codigo_unidad_de_venta")
    End With
End Sub

